package com.dyna;

import cn.hutool.core.thread.ThreadUtil;
import com.dyna.constants.AppConstant;
import com.dyna.launch.DynaApplication;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.util.concurrent.TimeUnit;

/**
 * @author dyna
 */
@EnableAspectJAutoProxy(exposeProxy = true) // 启用 expose-proxy,不启用的话，在获取代理对象时就会失败
@EnableFeignClients
@EnableDiscoveryClient
@EnableScheduling
@MapperScan(basePackages = "com.dyna.**.mapper")
@ConfigurationPropertiesScan(basePackages = "com.dyna.**.config.properties")
@SpringBootApplication(scanBasePackages = "com.dyna")
public class DemoApplication {
    public static void main(String[] args) {
        long startTime = System.currentTimeMillis();
        DynaApplication.run(AppConstant.APPLICATION_DEMO_NAME, DemoApplication.class, args);
        long stopTime = System.currentTimeMillis();
        ThreadUtil.sleep(1, TimeUnit.SECONDS); // 延迟 1 秒，保证输出到结尾
        System.out.println("\n--------------------------项目启动耗时："+ (stopTime - startTime) +"--------------------------------\n\t");

    }
}
